package com.enation.app.javashop.core.client.fallback.member;

import com.enation.app.javashop.core.client.feignimpl.member.MemberReceiptFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.member.dos.ReceiptHistory;
import com.enation.app.javashop.model.member.vo.ReceiptHistoryVO;
import org.springframework.stereotype.Component;

/**
 * 会员发票相关熔断fallback factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:26
 **/
@Component
public class MemberReceiptFallbackFactory extends BaseFallbackFactory<MemberReceiptFeignImpl> {
    @Override
    protected MemberReceiptFeignImpl fallback() {
        return new MemberReceiptFallback();
    }

    /**
     * 会员发票相关熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 下午4:12
     * @since v7.0
     */
    @Component
    public static class MemberReceiptFallback implements MemberReceiptFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());


        @Override
        public ReceiptHistoryVO getReceiptHistory(String orderSn) {
            logger.error("根据订单sn为" + orderSn + "的订单查询历史发票信息");
            return null;
        }

        @Override
        public ReceiptHistory add(ReceiptHistory receiptHistory) {
            logger.error("添加订单为sn为" + receiptHistory.getOrderSn() + "的订单历史发票信息错误");
            return null;
        }

        @Override
        public ReceiptHistory edit(ReceiptHistory receiptHistory) {

            logger.error("修改订单为sn为" + receiptHistory.getOrderSn() + "的订单历史发票信息错误");
            return null;
        }

        @Override
        public void updatePriceByOrderSn(Double orderPrice, String orderSn) {

            logger.error("修改订单为sn为" + orderSn + "的订单金额出错");
        }
    }
}
